package com.pgeg.listener;

import com.pgeg.materials.ModArmorMaterials;
import com.pgeg.registry.ItemGroupRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;

public class ArmorListener {

    /*Helmets*/
    public static final Item COPPER_HELMET = genHelmetSettings(ModArmorMaterials.COPPER_INGOT);
    public static final Item SILVER_HELMET = genHelmetSettings(ModArmorMaterials.SILVER_INGOT);
    public static final Item REDSTONE_HELMET = genHelmetSettings(ModArmorMaterials.REDSTONE);

    /*Chestplates*/
    public static final Item COPPER_CHESTPLATE = genChestplateSettings(ModArmorMaterials.COPPER_INGOT);
    public static final Item SILVER_CHESTPLATE =  genChestplateSettings(ModArmorMaterials.SILVER_INGOT);
    public static final Item REDSTONE_CHESTPLATE = genChestplateSettings(ModArmorMaterials.REDSTONE);

    /*Leggings*/
    public static final Item COPPER_LEGGINGS = genLeggingsSettings(ModArmorMaterials.COPPER_INGOT);
    public static final Item SILVER_LEGGINGS = genLeggingsSettings(ModArmorMaterials.SILVER_INGOT);
    public static final Item REDSTONE_LEGGINGS = genLeggingsSettings(ModArmorMaterials.REDSTONE);

    /*Boots*/
    public static final Item COPPER_BOOTS = genBootsSettings(ModArmorMaterials.COPPER_INGOT);
    public static final Item SILVER_BOOTS = genBootsSettings(ModArmorMaterials.SILVER_INGOT);
    public static final Item REDSTONE_BOOTS = genBootsSettings(ModArmorMaterials.REDSTONE);

    private static ArmorItem genHelmetSettings(ArmorMaterial material) {
        return new ArmorItem(material, EquipmentSlot.HEAD, (new FabricItemSettings().group(ItemGroupRegistry.COMBAT_GROUP)));
    }

    private static ArmorItem genChestplateSettings(ArmorMaterial material) {
        return new ArmorItem(material, EquipmentSlot.CHEST, (new FabricItemSettings().group(ItemGroupRegistry.COMBAT_GROUP)));
    }

    private static ArmorItem genLeggingsSettings(ArmorMaterial material) {
        return new ArmorItem(material, EquipmentSlot.LEGS, (new FabricItemSettings().group(ItemGroupRegistry.COMBAT_GROUP)));
    }

    private static ArmorItem genBootsSettings(ArmorMaterial material) {
        return new ArmorItem(material, EquipmentSlot.FEET, (new FabricItemSettings().group(ItemGroupRegistry.COMBAT_GROUP)));
    }
}
